#----------------------
# Top level SConstruct
#----------------------

import os
import sys

VERSION = '0.1.2'
ARCH = os.popen('dpkg --print-architecture 2>/dev/null || uname -m').read().strip()
MAINTAINER = 'Jayesh Salvi <jayesh@altfrequency.com>'
Export('VERSION ARCH MAINTAINER')

env = Environment()

#
# Set generic build options of the environment that 
# can be applied to all subdirectories
#
env.AppendUnique(CFLAGS=['-g'])
env.AppendUnique(CFLAGS=['-DDOUBLE_BUFFER'])

if ARCH == 'armel':
    #env.AppendUnique(CFLAGS=['-DHAS_XSP'])
    env.ParseConfig("pkg-config --cflags --libs xsp")

env.ParseConfig("pkg-config --cflags --libs libaltsvg")

def print_cmd_line(s, target, src, env):
    sys.stdout.write(" Compiling \033[01;32m %s\033[00m ...\n"%\
         (' and '.join([str(x) for x in target])))

if 'verbose' not in ARGUMENTS.keys():
    env['PRINT_CMD_LINE_FUNC'] = print_cmd_line

if 'prefix' in ARGUMENTS.keys():
    PREFIX = ARGUMENTS['prefix']
else:
    PREFIX = ''

Export('PREFIX')

Export('env')

#
# SConscript files of subdirectories
#

SConscript(['src/bindings/c/lib.sc'])
SConscript(['src/bindings/c/debian.sc'])

SConscript(['src/bindings/python/lib.sc'])
SConscript(['src/bindings/python/debian.sc'])

SConscript(['tests/SConscript'])
